package String;

public class _557_ReverseWordsinaStringIII {
    //use stringbuffer's reverse is so slow
    public String reverseWords(String s) {
        String[] origin = s.split(" ");
        String result = "";
        for(int i=0;i<origin.length;i++) {
            StringBuffer tempsb = new StringBuffer(origin[i]);
            result += tempsb.reverse().toString();
            result+=" ";
        }
        result = result.substring(0,result.length()-1);
        return result;
    }
}
